package com.example.security.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.nio.file.AccessDeniedException;
import java.util.HashMap;
import java.util.Map;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(AccessDeniedException.class)
    @ResponseBody
    public Map handlerAccessDeniedException(AccessDeniedException e){
        //1.记录日志
        
        //2.发送邮件或短信或告警电话
        
        //3.系统返回
        Map result = new HashMap<>();
        result.put("code",9527);
        result.put("msg","服务器正忙......请稍后再试");
        return result;
    }
}
